<%--                                                                       --%>
<%-- Copyright (c) 2001-2004 BroadVision, Inc.  All rights reserved.       --%>
<%--                                                                       --%>
<%-- This software is copyrighted. Under the copyright laws, this software --%>
<%-- may not be copied, in whole or in part, without prior written consent --%>
<%-- of BroadVision, Inc. or its assignees. This software is provided      --%>
<%-- under the terms of a license between BroadVision and the recipient,   --%>
<%-- and its use is subject to the terms of that license.                  --%>
<%--                                                                       --%>
<%-- This software may be protected by one or more U.S. and International  --%>
<%-- patents.  Certain applications of BroadVision One-To-One software are --%>
<%-- covered by U.S. patent 5,710,887.                                     --%>
<%--                                                                       --%>
<%-- TRADEMARKS: BroadVision and BroadVision One-To-One are registered     --%>
<%-- trademarks of BroadVision, Inc., in the United States and the         --%>
<%-- European Community, and are trademarks of BroadVision, Inc., in other --%>
<%-- countries.  The BroadVision logo, is a trademark of BroadVision,      --%>
<%-- Inc., in the United States and other countries. Additionally, IONA    --%>
<%-- and Orbix are trademarks of IONA Technologies, Ltd.  RSA, MD5, and    --%>
<%-- RC2 are trademarks of RSA Data Security, Inc.                         --%>
<%--                                                                       --%>

<%@ page import =  "org.apache.commons.beanutils.PropertyUtils,
                    com.broadvision.web.util.ViewDynaBean,
                    java.util.List"
%>

<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>

<script language="JavaScript">

  function closeWindow() {
    self.close();
  }
  
  function gotoPackDetails() {
    var myform = document.packageValidationForm;
    if (window.opener && !window.opener.closed) {
      myform.target = window.opener.name;
      myform.action = '<html:rewrite page="/bp/packageView.do"/>';
      myform.submit();
    }
  }
  
  function gotoPackModelList() {
    var myform = document.packageValidationForm;
    if (window.opener && !window.opener.closed) {
      myform.target = window.opener.name;
      myform.action = '<html:rewrite page="/bp/packageModelList.do"/>';
      myform.submit();
    }
  }
  
  function gotoModelStepAlertList(processOid, stepNumber) {
    var myform = document.packageValidationForm;
    if (window.opener && !window.opener.closed) {
      myform.processOid.value = processOid;
      myform.number.value = stepNumber;
      myform.target = window.opener.name;
      myform.action = '<html:rewrite page="/bp/processTaskAlertView.do"/>';
      myform.submit();
    }
  }
  
</script>

<html:form action="/bp/packageValidation.do">
<html:hidden name="packageValidationForm" property="id"/>
<input type="hidden" name="processOid"/>
<input type="hidden" name="number"/>
<!-- Zone 5 starts here.  -->
<table class="zoneFive" width="100%" border="0" cellspacing="0" cellpadding="0" summary="content area">
  <tr>
    <td valign="top" width="100%">
      <div class="generalWrapRight">
        <html:button property="closeWinBtn" styleClass="inputButton" onclick="javascript:closeWindow()">
          <bean:message key="button.close"  bundle="bp.messages"/>
        </html:button>
      </div> 
      <div class="pageTitle">
        <span class="left">
          <bean:write name="packageValidationView" property="name"/>
        </span>
        <span class="right">&nbsp;</span>
      </div>
      <div class="pageSubtitle">
        <span class="left"><bean:message key="bp.package.detail" bundle="bp.messages"/></span>
        <span class="right">&nbsp;</span>
      </div> 
      <table class="labelForm" width="100%" border="0" cellspacing="0" cellpadding="0" summary="Search criterias">
        <tr> 
          <td class="label" width="30%">
            <bean:message key="bp.package.packageName" bundle="bp.messages"/>:
          </td>
          <td class="labelField" width="70%">
            <bean:write name="packageValidationView" property="name"/>
          </td>
        </tr>
        <tr> 
          <td class="label" width="30%">
            <bean:message key="bp.package.validatePack.errorCount" bundle="bp.messages"/>
          </td>
          <td class="labelField" width="70%">
            <bean:write name="packageValidationView" property="errorCount"/>
          </td>
        </tr>
      </table>
      <div class="pageSubtitle">
        <span class="left"><bean:message key="bp.package.validatePack.invalidParticipant" bundle="bp.messages"/></span>
        <span class="right">&nbsp;</span>
      </div> 
      <table class="dataTable" border="0" cellspacing="1" cellpadding="2" summary="package participants" width="100%">
        <tr class="listHeader">
          <th id="Name" align="left">
            <bean:message key="bp.package.participantName" bundle="bp.messages"/>
          </th>
          <th id="Identities" align="left">
            <bean:message key="bp.package.validatePack.header.invalidParticipantIdentities" bundle="bp.messages"/>
          </th>
          <th id="Actions" align="left" nowrap>
            <bean:message key="header.actions" bundle="bp.messages"/>
          </th>
        </tr>
        <logic:empty name="packageValidationView" property="participants">
          <tr class="listEven">
            <td align="center" colspan="3">
              <bean:message key="bp.package.validatePack.allValidParticipants" bundle="bp.messages"/>
            </td>
          </tr>
        </logic:empty>
        <logic:notEmpty name="packageValidationView" property="participants">
          <logic:iterate id="participant" name="packageValidationView" property="participants" indexId="i">
            <tr class="<%=i.intValue() % 2 == 0 ? "listEven" : "listOdd" %>">
              <td headers="Name">
                <logic:equal name="participant" property="type" value="0">
                  <img src="<%=request.getContextPath()%>/bp/images/icons/individual.gif"  border="0" alt="<bean:message key="image.alt.individual" bundle="bp.messages"/>" title="<bean:message key="image.alt.individual" bundle="bp.messages"/>">
                </logic:equal>
                <logic:equal name="participant" property="type" value="1">
                  <img src="<%=request.getContextPath()%>/bp/images/icons/group.gif"  border="0" alt="<bean:message key="image.alt.group" bundle="bp.messages"/>" title="<bean:message key="image.alt.group" bundle="bp.messages"/>">
                </logic:equal>
                &nbsp;<bean:write name="participant" property="name"/>
              </td>
              <td headers="Identities">
                <logic:present name="participant" property="values">
                  <logic:iterate id="value" name="participant" property="values" indexId="m">
                    <bean:write name="value"/><br>
                  </logic:iterate>
                </logic:present>
              </td>
              <td nowrap align="left" headers="Actions">
                <a href='#' onclick="gotoPackDetails();">
                  <img src="<%=request.getContextPath()%>/bp/images/action/icon_view.gif" border="0" alt="<bean:message key="image.alt.view" bundle="bp.messages"/>" title="<bean:message key="image.alt.view" bundle="bp.messages"/>"></a>
              </td>
            </tr>
          </logic:iterate>
        </logic:notEmpty>
      </table>
      <logic:notEmpty name="packageValidationView" property="processes">
        <br>
        <div class="pageTitle2">
          <span class="left">
            <bean:define id="packageName" name="packageValidationView" property="name"/>
            <% String packageNameString = (String)pageContext.getAttribute("packageName"); %>
            <bean:message key="bp.package.validatePack.processModelsFor" arg0="<%= packageNameString %>" bundle="bp.messages"/>
          </span>
          <span class="right">&nbsp;</span>
        </div>
        <logic:iterate id="process" name="packageValidationView" property="processes" indexId="i">
          <br>
          <div class="pageSubtitle">
            <span class="left"><bean:message key="bp.process.processView.information" bundle="bp.messages"/></span>
            <span class="right">&nbsp;</span>
          </div> 
          <table class="labelForm" width="100%" border="0" cellspacing="0" cellpadding="0" summary="Search criterias">
            <tr> 
              <td class="label" width="30%">
                <bean:message key="bp.process.processName" bundle="bp.messages"/>
              </td>
              <td class="labelField" width="70%">
                <bean:write name="process" property="name"/>
              </td>
            </tr>
            <tr> 
              <td class="label" width="30%">
                <bean:message key="bp.package.validatePack.invalidModelManager" bundle="bp.messages"/>
              </td>
              <td class="labelField" width="70%">
                <logic:empty name="process" property="managerAlias">
                  <bean:message key="bp.package.validatePack.validModelManager" bundle="bp.messages"/>
                </logic:empty>
                <logic:notEmpty name="process" property="managerAlias">
                  <a href='#' onclick="gotoPackModelList();">
                    <bean:write name="process" property="managerAlias"/></a>
                </logic:notEmpty>
              </td>
            </tr>
          </table>
          <div class="pageSubsubtitle">
            <span class="left"><bean:message key="bp.package.validatePack.invalidStepAlert" bundle="bp.messages"/></span>
            <span class="right">&nbsp;</span>
          </div> 
          <table class="dataTable" border="0" cellspacing="1" cellpadding="2" summary="process model step alerts" width="100%">
            <tr class="listHeader">
              <th id="Step" align="left">
                <bean:message key="bp.package.validatePack.header.step" bundle="bp.messages"/>
              </th>
              <th id="AlertType" align="left">
                <bean:message key="bp.process.processTaskAlert.header.alertType" bundle="bp.messages"/>
              </th>
              <th id="AlertOthers" align="left">
                <bean:message key="bp.package.validatePack.header.invalidRecipients" bundle="bp.messages"/>
              </th>
              <th id="Actions" align="left" nowrap>
                <bean:message key="header.actions" bundle="bp.messages"/>
              </th>
            </tr>
            <logic:empty name="process" property="stepAlerts">
              <tr class="listEven">
                <td align="center" colspan="4">
                  <bean:message key="bp.package.validatePack.allValidRecipients" bundle="bp.messages"/>
                </td>
              </tr>
            </logic:empty>
            <logic:notEmpty name="process" property="stepAlerts">
              <logic:iterate id="stepAlert" name="process" property="stepAlerts" indexId="j">
                <tr class="<%=j.intValue() % 2 == 0 ? "listEven" : "listOdd" %>">
                  <td headers="Step">
                    <bean:write name="stepAlert" property="number"/>:<bean:write name="stepAlert" property="name"/>
                  </td>
                  <td headers="AlertType">
                    <logic:equal name="stepAlert" property="alertType" value="0">
                      <bean:message key="bp.process.processTaskAlert.alertType.reminder" bundle="bp.messages"/>
                    </logic:equal>
                    <logic:equal name="stepAlert" property="alertType" value="1">
                      <bean:message key="bp.process.processTaskAlert.alertType.taskCompletion" bundle="bp.messages"/>
                    </logic:equal>
                    <logic:equal name="stepAlert" property="alertType" value="2">
                      <bean:message key="bp.process.processTaskAlert.alertType.taskAvailable" bundle="bp.messages"/>
                    </logic:equal>
                    <logic:equal name="stepAlert" property="alertType" value="3">
                      <bean:message key="bp.process.processTaskAlert.alertType.taskAssignment" bundle="bp.messages"/>
                    </logic:equal>
                    <logic:equal name="stepAlert" property="alertType" value="5">
                      <bean:message key="bp.process.processTaskAlert.alertType.overdue" bundle="bp.messages"/>
                    </logic:equal>
                  </td>
                  <td headers="AlertOthers">
                    <logic:present name="stepAlert" property="userRecipients">
                      <logic:iterate id="userRecipient" name="stepAlert" property="userRecipients" indexId="k">
                        <bean:write name="userRecipient"/><br>
                      </logic:iterate>
                    </logic:present>
                    <logic:present name="stepAlert" property="groupRecipients">
                      <logic:iterate id="groupRecipient" name="stepAlert" property="groupRecipients" indexId="l">
                        <bean:write name="groupRecipient"/><br>
                      </logic:iterate>
                    </logic:present>
                  </td>
                  <td nowrap align="left" headers="Actions">
                    <a href='#' onclick="gotoModelStepAlertList('<bean:write name="process" property="oid"/>', '<bean:write name="stepAlert" property="number"/>');">
                      <img src="<%=request.getContextPath()%>/bp/images/action/icon_view.gif" border="0" alt="<bean:message key="image.alt.view" bundle="bp.messages"/>" title="<bean:message key="image.alt.view" bundle="bp.messages"/>"></a>
                  </th>
                </tr>
              </logic:iterate>
            </logic:notEmpty>
          </table>
        </logic:iterate>
      </logic:notEmpty>
    </td>
  </tr>
</table>
<!--end zone 5 content here -->
</html:form>

